/* 

Replication files for:
"Evaluating the Effect of Descriptive Norms on Political Tolerance"
By Fabian G. Neuner and Mark D. Ramirez
Published in American Politics Research

*/

*******************************************************************************
*****************************    Study 3   ************************************
*******************************************************************************

* Set scheme for figures

set scheme plotplain

* Load data

use "Study3_data.dta"
	des, short
	
	
********************** Study 3 Variables & Recodes ***********************


** Rename variables 
rename q14 consent
rename q27 dislikeA
rename q28 dislikeB
rename q31_1 scientists
rename q31_2 lawyers
rename q31_3 labels
rename q31_4 polls
rename q31_5 people 
rename q33 pidstem
rename q35 repstem
rename q37 demstem
rename q39 indstem 
rename q41 sex
rename q43 race
rename q23 speech_others
rename q24 disappointed
rename q16_1 freespeech
rename q16_2 threat
rename q16_3 hatespeech
rename q16_4 democracy 
rename q17 check 
rename q29_1 norm_perception


* Outcome variables by condition

** 80% intolerant responses
rename q17_1 tol1
rename q17_2 tol2
rename q17_3 tol3

** control group 
rename q10_1 con1
rename q10_2 con2 
rename q10_3 con3

** 62% intolerant 
rename q26_1 tol4
rename q26_2 tol5 
rename q26_3 tol6


* Recode outcomes (higher values more tolerance)
recode tol1 1=5 2=4 4=2 5=1
recode tol2 1=5 2=4 4=2 5=1
recode tol3 1=5 2=4 4=2 5=1
recode con1 1=5 2=4 4=2 5=1
recode con2 1=5 2=4 4=2 5=1
recode con3 1=5 2=4 4=2 5=1
recode tol4 1=5 2=4 4=2 5=1
recode tol5 1=5 2=4 4=2 5=1
recode tol6 1=5 2=4 4=2 5=1


* Outcome scales 

** 80%
alpha tol1 tol2 tol3, gen(outcome1) detail
** control 
alpha con1 con2 con3, gen(outcome2) detail 
** 62%
alpha tol4 tol5 tol6, gen(outcome3) detail

egen tolerance = rowtotal(outcome1 outcome2 outcome3)
recode tolerance 0=. 

** Generate treatment variable 
gen condition = . 
recode condition .=0 if outcome2 !=.
recode condition .=1 if outcome1 !=.
recode condition .=2 if outcome3 !=.


* Partisanship (Strong D to Strong Rep)

gen pid7 = . 
recode pid7 .=1 if demstem==1
recode pid7 .=2 if demstem==2
recode pid7 .=7 if repstem==1
recode pid7 .=6 if repstem==2
recode pid7 .=5 if indstem==1
recode pid7 .=3 if indstem==2
recode pid7 .=4 if indstem==3

* Partisanship (3 category)

gen pid3 = pid7 
recode pid3 1=0 2=0 3=0 4=1 5=2 6=2 7=2


* Rescaling 0-1

foreach x in tolerance pid7 {
sum `x'
gen `x'01 = (`x'-r(min))/(r(max)-r(min))
}



********************** Study 3 Analysis ***********************

* Figure 4
reg tolerance01 i.condition

coefplot, drop(_cons) xline(0) msymbol(O) levels(95 90) ///
 plotregion(fcolor(white) lcolor(gs10) lwidth(med)) ///
 ylabel(, /// y-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
xlabel( -.05 0 .1 .1 .2 .3 .4, /// x-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
 xtitle("ATE of each Treatment vs. Control", color(black)) ///
 mcolor(black) mlcolor(black)  /// point estimate color options
ciopts(lwidth(*0.75 *1.5) lcolor(black black)) ///
coeflabels(1.condition = `" 80% Intolerant"' 2.condition = `"62% Intolerant"') ///
grid(none) //
graph export Figure4.pdf


* Figure A.1 

reg tolerance01 i.condition if pid3==0 // 
estimates store s3_Democrat

reg tolerance01 i.condition if pid3==2 // 
estimates store s3_Republican


coefplot (s3_Democrat), bylabel(Among Democrats) ///
 plotregion(fcolor(white) lcolor(gs10) lwidth(med)) ///
  ylabel(, /// y-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
xlabel( -.1 0 .1 .2 .2 .3 .4, /// x-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
 xtitle("ATE of each Treatment vs. Control", color(black)) ///
 mcolor(black) mlcolor(black) msymbol(O)  /// point estimate color options
ciopts(lwidth(*0.75 *1.5) lcolor(black black)) ///
|| (s3_Republican), bylabel(Among Republicans) ///
|| , drop(_cons) yline(0) levels(95 90) coeflabels(1.condition = `"80% Intolerant"' 2.condition = `"62% Intolerant"') ///
grid(none) ///
xline(0, lp(dash) lcolor(grey)) //
graph export FigureA1.pdf


* Table A.7

reg tolerance01 i.condition
est sto m1

esttab m1 using TableA7.rtf, replace se label nonumber title("Effect of Norms on Tolerance (Study 3)") mtitle("Model 1")  b(%9.2f) star(* 0.10 ** 0.05 ) r2 wide


* Table 3 

reg tolerance01 i.condition##c.pid701
est sto m3

esttab m3 using Table3.rtf, replace se label nonumber title("Examining the Effect of Norms of Intolerance, Moderated by Partisanship (Study 3)") mtitle("Model 1")  b(%9.2f) star(* 0.10 ** 0.05 ) r2 wide

